

/*------------------------------------------------------------------------------
	1. Housekeepings
------------------------------------------------------------------------------*/

	*Settings
		set more off
		pause off
		clear
	
	*Set Globals
		global data = "...\Data"
		global output = "...\Output\Tables"
		
		
/*------------------------------------------------------------------------------
	2. Create Table 1:
------------------------------------------------------------------------------*/	

import excel using "${data}\table_backup_data.xlsx", clear first sheet("base_table")

	foreach i of varlist perc_insured perc_claimed*{
		replace `i' = `i'*100
	}

	foreach i of varlist perc_insured perc_claimed*{
		mkmat `i', matrix(`i')
		mat `i' = `i''
	}

cap program drop claim_dat

	program claim_dat, eclass
		*returned in e() structure
		foreach i of varlist perc_insured perc_claimed*{
			eret mat `i' = `i'
		}
	end

	estimates clear
	eststo clear

	claim_dat
	
#delimit ;
esttab using "$output\base_table.tex", replace
	booktabs nogaps label noobs collabels(none) nonumber eqlabels(none) nomtitles  substitute(.\\ \\)
	cells("perc_insured (fmt(%10.1fc)) perc_claimed (fmt(%10.1fc)) perc_claimed_lb (fmt(%10.1fc)) perc_claimed_ub (fmt(%10.1fc))") 
	prehead(\begin{table}[htbp]            
			\footnotesize   
			\caption{Child Claim Rate By Year}    
			\label{tab:main}
			\makebox[\textwidth][c]{                
			\centering  
			\begin{tabular}{l*{4}{c}} 
			\toprule        
			& \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)} & \multicolumn{1}{c}{(4)} \\
			\cmidrule(lr){2-5} 
			& \multicolumn{1}{c}{Percent Insured} & \multicolumn{1}{c}{Main Sample} & \multicolumn{1}{c}{Manski} & \multicolumn{1}{c}{Manski} \\
			& \multicolumn{1}{c}{} & \multicolumn{1}{c}{(Form 1095)} & \multicolumn{1}{c}{Lower Bound} & \multicolumn{1}{c}{Upper Bound}  \\
			\midrule)
	varl(r1 "2017"
	   	 r2 "2018"
	     r3 "2019"
		 r4 "2020"
		 r5 "2021")		
		 postfoot(\midrule 
		 \multicolumn{5}{p{2in}}{\footnotesize{\emph{Notes:"Column 1 reports the estimated fraction of U.S. children who appear on a Form 1095 by year; the estimate is derived by dividing the total number of U.S. children appearing on a Form 1095 by the total number of children estimated by \citet{census_2020} to live in the U.S. Column 2 reports our baseline estimate of the child claim rate by year; the estimate is equal to the fraction of children appearing on a Form 1095 that are claimed on one or more tax returns. Columns 3 and 4 report extreme bounds on the child claim rate for the overall population of U.S. children (not limited to children claimed on a Form 1095) under the assumptions that uninsured children are claimed at a rate of 0 percent (Column 3) or 100 percent (Column 4)."} }}        
			\end{tabular}}
			\end{table});;
#delimit cr

